<?php
namespace App\Http\Controllers\Item\Fxotary\Front;

use App\Service\Item\Fxotary\Front\MenuService;
use Illuminate\Http\Request;

class MenuController extends BaseController
{
    //项目菜单

    public function __construct(MenuService $service)
    {
        $this->db = $service;
    }

    //页面菜单
    public function leftMenu(Request $request)
    {
        //header('Access-Control-Allow-Origin: *');
        $item_id = $request->post('item_id', 1);
        $res = $this->db->getList($item_id);
        if ($res['code'] < 0) {
            return $this->toJson(-2, $res['msg']);
        }
        return $this->toJson(0, '', $res['data']);
    }

    //页脚
    public function foot(Request $request)
    {
        //header('Access-Control-Allow-Origin: *');
        $item_id = $request->post('item_id', 1);
        $res = $this->db->foot($item_id);
        if ($res['code'] < 0) {
            return $this->toJson(-2, $res['msg']);
        }
        return $this->toJson(0, '', $res['data']);
    }
}